﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Dala.Helpers;

namespace Dala.Samples.User_Controls.message_display
{
    public partial class message_display : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            MessageDisplayHelper.ClearMessage(divMessage, ulMessage);
        }

        public void DisplayMessage(String message, bool isError = default(bool), bool isInfo = default(bool))
        {
            MessageDisplayHelper.DisplayMessage(message, divMessage, ulMessage, isError, isInfo);
        }

        public void DisplayMessage(Exception errorObject, bool isError = default(bool), bool isInfo = default(bool))
        {
            if (errorObject.InnerException != null)
            {
                MessageDisplayHelper.DisplayMessage(errorObject.InnerException.Message, divMessage, ulMessage, isError, isInfo);
            }
            else
            {
                MessageDisplayHelper.DisplayMessage(errorObject.Message, divMessage, ulMessage, isError, isInfo);
            }
        }
    }
}